<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
 <jsp:useBean id="db" class="ctm.javacode.dbBean"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>營養品維護</title>
<%
String userAgent = request.getHeader("User-Agent");
System.out.println("瀏覽器： "+userAgent+"\n");
%>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!--<script
	src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>-->
<script language="Javascript" type="text/javascript" src="./JQuery/maintenanceNourishment.js"></script>
<style type="text/css">
<!--
body {
	background-image: url(img/grass.jpg);
	background-position: center top;
	background-color: #FFFFFF;
	background-repeat: repeat;
}

body,td,th {
	color: #000000;
	font-size: 24px;
	font-family: Arial;
}

a:link {
	text-decoration: none;
	font-family: Arial;
	font-size: 20px;
	color: #FFFFFF;
}

a:visited {
	text-decoration: none;
	font-family: Arial;
	font-size: 20px;
	color: #FFFFFF;
}

a:hover {
	text-decoration: none;
	font-family: Arial;
	font-size: 20px;
	color: #000000;
}

.ind:link {
	color: #535353;
	text-decoration: none;
	font-family: "標楷體";
	font-size: 18px;
}

.ind:visited {
	color: #535353;
	text-decoration: none;
	font-family: "標楷體";
	font-size: 18px;
}

.ind:hover {
	color: #BB280F;
	text-decoration: none;
	font-family: "標楷體";
	font-size: 18px;
}

.off {
	display: none;
}

.on {
	display: block;
}

.HEAD_STYLE {
	font-weight: bold;
	color: #437A27;
	font-family: "標楷體";
	font-size: 30px;
}

.TEXT_STYLE {
	font-family: "標楷體";
	color: #000000;
	font-size: 24px;
}

.BOTTOM_STYLE {
	color: #FFFFFF;
	font-family: Arial;
	font-size: 20px;
}

.LEFT_BUTTON {
	font-family: "標楷體";
	font-size: 30px;
}

.button {
	border: 1px;
	padding-top: 4px;
	padding-right: 7px;
	padding-bottom: 4px;
	padding-left: 7px;
	background-color: #468129;
	color: #FFFFFF;
	font-size: 16px;
	border-color: #3C7023;
}

.button2 {
	border: 1px;
	padding-top: 4px;
	padding-right: 7px;
	padding-bottom: 4px;
	padding-left: 7px;
	background-color: #468129;
	color: #FFFFFF;
	font-size: 20px;
	border-color: #3C7023;
}

.style2 {
	color: #437A27;
	font-weight: bold;
	font-size: 30px;
}

.style3 {
	color: #437A27;
	font-weight: bold;
}
-->
</style>
</head>

<body alink="#FF0000" vlink="#FF0000">

	<%
	/******設定******/
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html");
	response.setCharacterEncoding("UTF-8");
	db.setDataSource("jdbc/ctmpllab");
	db.Connected();

	String sqlQuery = "select distinct company from `nourishment`";
	ResultSet rs;
	rs = db.ExcuteQuery(sqlQuery);


	%>

	<table width="100%" border="0">
		<tr>
			<td><p>&nbsp;</p></td>
		</tr>
		<tr>
			<td width="5%">&nbsp;</td>
			<td bgcolor="#FFFFFF">
				<table width="100%" border="0">
					<tr>
						<td background="img/herbal.jpg">
							<p>&nbsp;</p>
							<p>&nbsp;</p>
							<p>&nbsp;</p>
							<p>&nbsp;</p>
							<p>&nbsp;</p>
						</td>
					</tr>
					<tr>
						<td>
							<table bgcolor="#437A27" width="100%" border="0">
								<tr>
									<td>&nbsp;</td>
									<td width="20%" align="center"><a href="main.jsp"
										target="_parent">回到主選單</a></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td>
						<table width="100%">
							<tr><td  align="center">
							<span class="style2">營養品維護系統</span>
							</td></tr>
							
							<tr><td>
								<span class="style3">公司 : </span>
								<select id="company" style="font-size: 18px">
								<option>請選擇</option>
								<%
								while (rs.next()) {
									try {
										out.print("<option value='" + rs.getString("company")+ "'>");
										out.print(rs.getString("company"));
										out.print("</option>");
									} catch (SQLException e) {
										throw new SQLException(e);
									} // end try-catch
								}
								db.CloseConn();
								%>
								</select>
								<span class="style3"> 產品: </span>
								<select id="product" style="font-size: 18px">
								<option>請選擇</option>
								</select>
							</td></tr>
						</table>
						<!--  <div id="dialog-modified_confirm" title="修改確認">
							<p>
								<span class="ui-icon ui-icon-alert" style="float: left;"></span>確定要修改?
							</p>
						</div>
						<div id="dialog-delete_confirm" title="刪除確認">
							<p>
								<span class="ui-icon ui-icon-alert" style="float: left;"></span>確定要刪除?
							</p>
						</div>
						<div id="dialog-add_confirm" title="新增確認">
							<p>
								<span class="ui-icon ui-icon-alert" style="float: left;"></span>確定要新增?
							</p>
						</div>-->
						<form name="nourishment" action="#">
								<div align="center"></div>
								<div align="left">
									<input name="button" type="button" id="InsertToDatabase" value="新增" class="button2"/> 
									<input name="button" type="button" id="ModifiedToDatabase" value="修改" class="button2"/>
									<input name="button" type="button" id="DeleteToDatabase" value="刪除" class="button2"/> 
									<input name="button" type="button" id="reset" value="清空" class="button2"/>
								</div>
								<br>
								<table width="100%" border="1">
									<tr>
										<td align="center">公司</td>
										<td align="center">商品</td>
										<td align="center">粉末(g)</td>
										<td align="center">水份</td>
										<td align="center">熱量</td>
										<td align="center">蛋白質</td>
										<td align="center">脂肪</td>
										<td align="center">醣類</td>
										<td align="center">纖維</td>
										<td align="center">鈣(mg)</td>
										<td align="center">磷(mg)</td>
										<td align="center">鈉(mg)</td>
										<td align="center">鉀(mg)</td>
										<td align="center">鎂(mg)</td>
										<td align="center">克/匙</td>
									</tr>

									<tr>
										<td align="center"><input type="text" id="a0"
											name="company" style="width: 80px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a1"
											name="productname" style="width: 150px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a2"
											name="powder" style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a3"
											name="water" style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a4" name="kcal"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a5"
											name="protein" style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a6" name="fat"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a7"
											name="carbohydrate" style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a8"
											name="fiber" style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a9" name="ca"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a10" name="p"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a11" name="na"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a12" name="k"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a13" name="mg"
											style="width: 50px; text-align: right"></input></td>
										<td align="center"><input type="text" id="a14" name="g_spoon"
											style="width: 50px; text-align: right"></input></td>
									</tr>
								</table>
							</form>
					</td></tr>
					<tr>
						<td><p>&nbsp;</p></td>
					</tr>
					<tr>
						<td bgcolor="#437A27">
							<div align="center" class="BOTTOM_STYLE">Copyright@ITRI and CCU_PLlab</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="5%">&nbsp;</td>
		</tr>
	</table>
	<p>&nbsp;</p>
</body>
</html>